import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import '../model/room_music_center_controller.dart';
import '../model/room_music_search_controller.dart';
import '../widget/music_item_widget.dart';

/// 音乐搜索结果页面
class RoomMusicSearchPage extends StatelessWidget {
  final centerController = Get.find<RoomMusicCenterController>();

  RoomMusicSearchPage({super.key}) {
    Get.put(RoomMusicSearchController());
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<RoomMusicSearchController>(builder: (logic) {
      if (logic.data == null) {
        return const Center(child: CupertinoActivityIndicator());
      }

      if (logic.count <= 0) {
        // return Center(child: DFEmptyDataView());
      }

      return Column(
        mainAxisSize: MainAxisSize.max,
        children: [
          Expanded(
            child: ListView.builder(
              itemBuilder: (c, index) {
                bool isLast = index == logic.count - 1;
                return Padding(
                  padding: EdgeInsets.only(top: 4, bottom: isLast ? 130 : 4),
                  child: Text('MusicItemWidget'),
                  // child: MusicItemWidget(item: logic.data!.getMusic(index)),
                );
              },
              itemCount: logic.count,
            ),
          )
        ],
      );
    });
  }
}
